package com.yanfan.energy.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.energy.mapper.NjEnergyIpMapper;
import com.yanfan.energy.domain.NjEnergyIp;
import com.yanfan.energy.service.INjEnergyIpService;

/**
 * 能耗ipService业务层处理
 *
 * @author genluo
 * @date 2024-10-29
 */
@Service
public class NjEnergyIpServiceImpl extends ServiceImpl<NjEnergyIpMapper, NjEnergyIp> implements INjEnergyIpService {
    @Autowired
    private NjEnergyIpMapper njEnergyIpMapper;


    /**
     * 查询能耗ip列表
     *
     * @param njEnergyIp 能耗ip
     * @return 能耗ip
     */
    @Override
    public List<NjEnergyIp> queryPageList(NjEnergyIp njEnergyIp) {
        LambdaQueryWrapper<NjEnergyIp> lqw = buildQueryWrapper(njEnergyIp);
        return njEnergyIpMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njEnergyIpMapper.queryPageList(njEnergyIp);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjEnergyIp> buildQueryWrapper(NjEnergyIp bo) {
        LambdaQueryWrapper<NjEnergyIp> lqw = Wrappers.lambdaQuery();
        lqw.eq(StringUtils.isNotBlank(bo.getPosition()), NjEnergyIp::getPosition, bo.getPosition());
        lqw.eq(StringUtils.isNotBlank(bo.getIpAddress()), NjEnergyIp::getIpAddress, bo.getIpAddress());
        return lqw;
    }



}
